1. /* slmststr.cpp by K.Tsuru */
  2. // function ID = 201
  3. /***************************
  4. SLong class
  5. Set a value by string *s.
  6. ****************************/
  7. #ifndef SN_H
  8. #include "sn.h"
  9. #endif
  10. void SLong::SetString(const char *s){
  11. StringToNumber temp(s);
  12. //check overflow & underflow
  13. if(temp.Type() & DEC_INT){ // integral type
  14. SNumber::CopyValue(temp, SUBS); //direct copy
  15. } else {
  16. //floating point type
  17. //temp = 0.aaaa bbbb cccc.... *R^p ===> aaaa bbbb cccc. *R^0
  18. int p = temp.RdxExp();
  19. if( p >= (int)MaxSize() ){
  20. SetError(OVERFLOW_ERR,"SL SetString", 201); return;
  21. } else if(p <= 0){
  22. //The absolute value is smaller than one.
  23. SetZero(); return;
  24. }
  25. uint q = (uint)p, j, last = min(q, temp.Head());
  26. valloc(q , 0);
  27. for(j = 1; j <= last; j++) figure[p-j] = temp[j];
  28. SetSign(temp.Sign());
  29. CheckArray(201);
  30. }
  31. }

slmststr.cpp : last modifiled at 2017/03/17 11:10:48(865 bytes)
created at 2017/10/07 10:26:49
The creation time of this html file is 2017/11/09 14:52:03 (Thu Nov 09 14:52:03 2017).